<?php

if(!defined('IN_refrigeratory')) {
	exit('Access Denied');
}

$operation = $_REQUEST["operation"];
$operations = array("info_medicine");

if (!in_array($operation, $operations)){
	echo '{"success":false, "info":"request params invalid"}';
	exit;
}

if ($operation == "info_medicine"){
	$sql = "SELECT m.id_medicine,m.identifier,m.name,SUM(stock) count,b.unit
			FROM t_medicine m
			LEFT JOIN t_batch b ON m.id_medicine = b.id_medicine
			GROUP BY m.id_medicine";
	echo get_json_from_sql($sql);
}

?>